import Cookies from 'js-cookie'

const TokenKey = 'Token'
const UserKey = 'User'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function getUser() {
  if(Cookies.get(UserKey)){
    return JSON.parse(Cookies.get(UserKey))
  }else{
    Cookies.remove(UserKey)
    return null
  }
  
}
export function setUser(user) {
  
  return Cookies.set(UserKey, JSON.stringify(user))
}
export function removeToken() {
  Cookies.remove(UserKey)
  return Cookies.remove(TokenKey)

}
